﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows;
using System.Windows.Controls;

namespace BlueRadar.UI
{
    public class PositionHelper
    {
        public double X { get; set; }
        public double Y { get; set; }

        private int r = 225;
        private double delta = 200;
        private Random rnd;
        private Canvas RadarGrid;

        public PositionHelper(Canvas radar)
        {
            rnd = new Random();
            this.RadarGrid = radar;
        }

        public void Random()
        {
            double y = 0;
            double x = 0;
            while (Math.Pow((y - delta), 2) + Math.Pow((x - delta), 2) > Math.Pow(r, 2))
            {
                double angle = rnd.Next(0, 360);
                double radius = rnd.Next(0, r);
                y = Math.Sin(angle) * radius + delta;
                x = Math.Cos(angle) * radius + delta;
            }
            this.Y = y;
            this.X = x;
        }
    }
}
